﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrLoopEdgeTraverser : OdBrTraverser
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrLoopEdgeTraverser(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdBrLoopEdgeTraverser_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrLoopEdgeTraverser obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrLoopEdgeTraverser()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrLoopEdgeTraverser(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGeCurve3d getOrientedCurve()
		{
			OdGeCurve3d result = new OdGeCurve3d(GlobalsPINVOKE.OdBrLoopEdgeTraverser_getOrientedCurve(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getOrientedCurveAsNurb(OdGeNurbCurve3d nurb)
		{
			bool result = GlobalsPINVOKE.OdBrLoopEdgeTraverser_getOrientedCurveAsNurb(this.swigCPtr, OdGeNurbCurve3d.getCPtr(nurb));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGeCurve2d getParamCurve()
		{
			OdGeCurve2d result = new OdGeCurve2d(GlobalsPINVOKE.OdBrLoopEdgeTraverser_getParamCurve(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus getParamCurveAsNurb(OdGeNurbCurve2d nurb)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrLoopEdgeTraverser_getParamCurveAsNurb(this.swigCPtr, OdGeNurbCurve2d.getCPtr(nurb));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getEdgeOrientToLoop()
		{
			bool result = GlobalsPINVOKE.OdBrLoopEdgeTraverser_getEdgeOrientToLoop(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrEdge getEdge()
		{
			OdBrEdge result = new OdBrEdge(GlobalsPINVOKE.OdBrLoopEdgeTraverser_getEdge(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrLoop getLoop()
		{
			OdBrLoop result = new OdBrLoop(GlobalsPINVOKE.OdBrLoopEdgeTraverser_getLoop(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setEdge(OdBrEdge edge)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrLoopEdgeTraverser_setEdge(this.swigCPtr, OdBrEdge.getCPtr(edge));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setLoop(OdBrLoop loop)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrLoopEdgeTraverser_setLoop(this.swigCPtr, OdBrLoop.getCPtr(loop));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setLoopAndEdge(OdBrEdgeLoopTraverser edgeLoop)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrLoopEdgeTraverser_setLoopAndEdge(this.swigCPtr, OdBrEdgeLoopTraverser.getCPtr(edgeLoop));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrLoopEdgeTraverser() : this(GlobalsPINVOKE.new_OdBrLoopEdgeTraverser(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
